#include "port3deditor.h"
#include <QtGui/QApplication>
#include <QPluginLoader>
#include <QTextCodec>
#include "uiresource.h"
#include "utility.h"
#include <QResource>

int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	if(QLocale::system().language() == QLocale::Chinese)
	{
		setlocale( LC_ALL, "chs" );
	}
	QPluginLoader * plugin;
	#ifndef NDEBUG
	{
		plugin = new QPluginLoader(QApplication::applicationDirPath() + "/qcncodecsd4.dll");
	}
	#else
	{
		plugin = new QPluginLoader(QApplication::applicationDirPath() + "/qcncodecs4.dll");
	}
	#endif
	if(plugin->load())
	{
		ChineseTextCodec::SetChineseCodecPluginObject(plugin->instance());
		QTextCodec::setCodecForLocale(QTextCodec::codecForName("GBK"));
		QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK"));
		QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK"));
	}
	Q_INIT_RESOURCE(port3deditor);
	UIResources::staticInitialize();

	Port3DEditor w;
	w.show();
	return a.exec();
}
